cmake_minimum_required(VERSION 3.5.1)

set(CMAKE_CXX_STANDARD 14)

project(lidarodom)



find_package(catkin REQUIRED COMPONENTS
  roscpp
  sensor_msgs
  nav_msgs
  roslaunch
  pcl_conversions
  pcl_ros
)

include_directories(
 include
  ${catkin_INCLUDE_DIRS} )



catkin_package(
  CATKIN_DEPENDS
  geometry_msgs
  nav_msgs
  roscpp
  sensor_msgs
  tf2
  INCLUDE_DIRS
  LIBRARIES icp_lib
)

#add gsl library
FIND_PACKAGE(GSL REQUIRED)
IF(GSL_FOUND)
    MESSAGE(STATUS "Found GSL:")
    MESSAGE(STATUS "   GSL_LIBRARIES = ${GSL_LIBRARIES}")
    MESSAGE(STATUS "   GSL_INCLUDE_DIR = ${GSL_INCLUDE_DIR}")
    MESSAGE(STATUS "   CMAKE_GSL_CXX_FLAGS = ${CMAKE_GSL_CXX_FLAGS}")
    MESSAGE(STATUS "   GSL_LINK_DIRECTORIES = '${GSL_LINK_DIRECTORIES}'")


    set(icp_c_flags "${icp_c_flags} -I${GSL_INCLUDE_DIR}")
    if(GSL_LINK_DIRECTORIES)
        set(icp_link_flags "${icp_link_flags} -L${GSL_LINK_DIRECTORIES}")
    endif(GSL_LINK_DIRECTORIES)

    set(icp_link_flags "${icp_link_flags} ${GSL_LIBRARIES}")

ELSE(GSL_FOUND)
    MESSAGE(FATAL_ERROR "GSL not found.")
ENDIF(GSL_FOUND)


SET(SRC 
    src/csm.cpp
    src/egsl.cpp
    src/laser_data.cpp
    src/math_utils.cpp
    src/main.cpp)



add_executable(lidarodom ${SRC})

# add execute lib
target_link_libraries(lidarodom
        ${GSL_LIBRARIES}
        ${catkin_LIBRARIES}   
        )
